/*
  学习目标：掌握泛型接口 和 泛型别名
  场景: 大量重复结构时, 封装使用
  语法： type Xxx<T> = {}
  语法： interface Xxx<T> {}
*/

interface MyResponse<T> {
  code: number;
  msg: string;
  data: T;
}

type User = { id: string; name: string };
const user: MyResponse<User> = {
  code: 200,
  msg: "响应成功",
  data: {
    id: "1001",
    name: "zs",
  },
};

type Login = {
  token: string;
};

const logRes: MyResponse<Login> = {
  code: 200,
  msg: "响应成功",
  data: {
    token: "sdfafds",
  },
};
